﻿using Newtonsoft.Json;
using QDPay.Bus.domain.json;
using System;
using System.Collections.Generic;
using System.Text;

namespace QDPay.Bus
{
    public class BusinessBase
    {
        protected bool IsSuccess<T>(JsonBase<T> json)
        {
            if (json == null || json.Code != 0)
                return false;
            return true;
        }

        public string SerializeObject(object obj)
        {
           return JsonConvert.SerializeObject(obj);
        }

        public T DeserializeObject<T>(string json)
        {
            if (string.IsNullOrEmpty(json))
                return default(T);
            return JsonConvert.DeserializeObject<T>(json);
        }
    }
}
